package ca.uwindsor.cs.deepweb.utility;

import java.io.File;

public class FileCounter {

	protected File dataDir;

	protected int offset;
	
	protected int quality;
	
	protected String extenstion;

	public FileCounter(String dirpath, String ext) {
		quality=0;
		offset = 1;
		dataDir = new File(dirpath);
		extenstion = ext;
	}

	public void count() {
		File[] dataFiles = dataDir.listFiles();
		System.out.println("Start to process the files!");
		for (int i = 0; i < dataFiles.length; i++) {
			File file = dataFiles[i];
			if (file.isFile() && file.getName().endsWith("."+extenstion)) {
//				System.out.println(file.getName());
				quality ++;
			}
		}
		System.out.println("Quality: "+quality);
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FileCounter fc = new FileCounter(args[0],args[1]);
		fc.count();
	}

}
